package struts;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullBean {

	public FullBean(){
		
	}
	
	public static Object getBean(String formclass, HttpServletRequest request) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
		Class c = Class.forName(formclass);
		Object o = c.newInstance();
		Field[] field = c.getDeclaredFields();
		for(Field f : field){
			f.setAccessible(true);
			f.set(o, request.getParameter(f.getName()));
			f.setAccessible(false);
		}
		return o;
	}
	
}
